/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Ui.guiComponents;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

/**
 *
 * @author Elya
 */
public class BoardPanel extends JPanel implements ActionListener {
    
    private JLabel labelPlayerName;
    private JTextField textPlayerTurn;
    private JTextField textRenamePlayer;
    private JComboBox comboChooseType;
    private Grid board;

    
    public BoardPanel(){
        init();

    }
    
    public BoardPanel getBoardPanel(){
        return this;
    }
            
    public void setAllVisible(boolean aFlag){
        labelPlayerName.setVisible(aFlag);
        textPlayerTurn.setVisible(aFlag);
        textRenamePlayer.setVisible(aFlag);
        comboChooseType.setVisible(aFlag);
        board.setVisible(aFlag);

    }
    
    public boolean isAllVisible(){
        if(labelPlayerName.isVisible() && textPlayerTurn.isVisible() && textRenamePlayer.isVisible() && comboChooseType.isVisible() && board.isVisible())
            return true;
        else
            return false;
    }

    private void init(){
        setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

        board=new Grid();
        board.setMaximumSize(new Dimension(271,270));
                
        
        setBackground(new java.awt.Color(83, 138, 219));
        setBorder(javax.swing.BorderFactory.createEtchedBorder());
        
   
        labelPlayerName = new javax.swing.JLabel();
        textRenamePlayer = new javax.swing.JTextField();
        textPlayerTurn = new javax.swing.JTextField();
        comboChooseType = new javax.swing.JComboBox();



        labelPlayerName.setFont(new java.awt.Font("Arial", 1, 18));
        labelPlayerName.setText("ELYA ALPERN");

        labelPlayerName.setToolTipText("player name");

        labelPlayerName.setAlignmentX(Component.CENTER_ALIGNMENT);
        labelPlayerName.setAlignmentY(Component.CENTER_ALIGNMENT);
        labelPlayerName.setSize(new Dimension(275,22));

        textRenamePlayer.setBackground(new java.awt.Color(83, 138, 219));
        textRenamePlayer.setFont(new java.awt.Font("Arial", 0, 12));
        textRenamePlayer.setForeground(new java.awt.Color(255, 255, 255));
        textRenamePlayer.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED), "Rename Player", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Arial", 1, 12))); // NOI18N
        textRenamePlayer.setSelectedTextColor(new java.awt.Color(0, 0, 0));
        textRenamePlayer.setSelectionColor(new java.awt.Color(153, 204, 255));
        textRenamePlayer.setAlignmentX(Component.CENTER_ALIGNMENT);
        textRenamePlayer.setAlignmentY(Component.CENTER_ALIGNMENT);
        textRenamePlayer.setMaximumSize(new Dimension(165,42));
        
        textPlayerTurn.setBackground(new java.awt.Color(83, 138, 219));
        textPlayerTurn.setEditable(false);
        textPlayerTurn.setFont(new java.awt.Font("Arial", 0, 12));
        textPlayerTurn.setForeground(new java.awt.Color(255, 255, 255));
        textPlayerTurn.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED), "Turn", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Arial", 1, 12))); // NOI18N
        textPlayerTurn.setSelectedTextColor(new java.awt.Color(0, 0, 0));
        textPlayerTurn.setSelectionColor(new java.awt.Color(153, 204, 255));
        textPlayerTurn.setAlignmentX(Component.CENTER_ALIGNMENT);
        textPlayerTurn.setAlignmentY(Component.CENTER_ALIGNMENT);
        textPlayerTurn.setMaximumSize(new Dimension(42,42));

        comboChooseType.setBackground(new java.awt.Color(83, 138, 219));
        comboChooseType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Human", "Computer" }));
        comboChooseType.setSelectedIndex(-1);
        comboChooseType.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Player Type", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.ABOVE_TOP));
        comboChooseType.setAlignmentX(Component.CENTER_ALIGNMENT);
        comboChooseType.setAlignmentY(Component.CENTER_ALIGNMENT);
        comboChooseType.setMaximumSize(new Dimension(86,50));
        
        Dimension minSize = new Dimension(0, 15);
        Dimension prefSize = new Dimension(0, 15);
        Dimension maxSize = new Dimension(Short.MAX_VALUE, 15);
        

        add(new Box.Filler(new Dimension(0, 20), new Dimension(0, 20), new Dimension(0, 20)));
        add(labelPlayerName);
        add(new Box.Filler(new Dimension(0, 20), new Dimension(0, 20), new Dimension(0, 20)));
        add(textPlayerTurn);
        add(new Box.Filler(minSize, prefSize, maxSize));
        add(comboChooseType);
        add(new Box.Filler(minSize, prefSize, maxSize));
        add(textRenamePlayer);
        add(new Box.Filler(minSize, prefSize, maxSize));
        add(board);
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

}
